<div class="weui_cells weui_cells_form" ng-repeat="(i,item) in pagedata.item.diyform" style="margin-top:0">
            <div class="weui_cell" ng-if="item.type == 1  || item.type == 9">
                <div class="weui_cell_hd"><label class="weui_label">{{item.title}}<span ng-if="item.is_must || item.ismust" class="must"></span></label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="text" ng-model="item.data" placeholder="输入{{item.title}}">
                </div>
            </div>
			 <div class="weui_cell" ng-if="item.type == 2 || item.type == 8 || item.type == 12">
                <div class="weui_cell_hd"><label class="weui_label">{{item.title}}<span ng-if="item.is_must || item.ismust" class="must"></span></label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="number" ng-model="item.data" placeholder="输入{{item.title}}">
                </div>
            </div>
			<div class="weui_cell" ng-if="item.type == 18">
                <div class="weui_cell_hd"><label class="weui_label">{{item.title}}<span ng-if="item.is_must || item.ismust" class="must"></span></label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="number" ng-model="item.data" placeholder="输入{{item.title}}">
                </div>
            </div>
			<div class="weui_cell" ng-if="item.type == 3">
					<div class="weui_cell_hd"><label class="weui_label">{{item.title}}<span ng-if="item.is_must || item.ismust" class="must"></span></label></div>
					<div class="weui_cell_bd weui_cell_primary">
						<ul class="weui_uploader_files" ng-if="item.data">
							  <li class="weui_uploader_file" style="background-image:url({{tomedia(item.data)}})"></li>
						</ul>
						<div class="weui_uploader_input_wrp">
							 <input class="weui_uploader_input" ng-model="item.data" ng-click="up_file(item,'data','image')" accept="image/jpg,image/jpeg,image/png,image/gif" multiple="">
						</div>
					</div>
			</div>
				<div ng-if="item.type == 4" class="weui_cells_title" style="padding-left:0">{{item.title}}</div>
				<div ng-if="item.type == 4" class="weui_cells weui_cells_radio2">
						<label class="weui_cell weui_check_label dashed" ng-repeat="(key,value) in item.value">
							<div class="weui_cell_bd weui_cell_primary">
								<span style="float:left;width:100%">{{value.title}}</span>
							</div>
							<div class="weui_cell_ft" href="javascript:;"  ng-click="item.data=value.title;">
								<input type="radio" class="weui_check" ng-checked='item.data==value.title' name="radio{{i}}">
								<span class="weui_icon_checked"></span>
							</div>
						</label>
				</div>
				<div class="weui_cell" ng-if="item.type == 19">
							<div class="weui_cell_hd"><label class="weui_label">{{item.title}}</label></div>
							<div class="weui_cell_bd weui_cell_primary">
								<select class="weui_select" ng-model="item.data">
									<option ng-repeat="(key,value) in item.value" selected="item.data==value.title;" value="{{value.title}}">{{value.title}}</option>
								</select>
							</div>
				</div>
				<div ng-if="item.type == 5" class="weui_cells_title" style="padding-left:0">{{item.title}}</div>
				<div ng-if="item.type == 5" class="weui_cells weui_cells_checkbox" style="padding:0.5rem">
						<div class="fui-cell-label" style="margin-right:0.8rem;float:left;margin-bottom:0.2rem" ng-repeat="(key,value) in item.value">
							<input type="checkbox" ng-click="duoxuans(value.title,item,'data')" class="fui fui-checkbox fui-checkbox-danger verify-checkbox" value="{{value.title}}" id="s11"> {{value.title}}
						</div>
				</div>
				<div ng-if="item.type == 6" class="weui_cells_title" style="padding-left:0">{{item.title}}</div>
				<div ng-if="item.type == 6" class="weui_cells weui_cells_form">
				<div class="weui_cell">
						<div class="weui_cell_bd weui_cell_primary">
							<textarea class="weui_textarea" ng-model="item.data" placeholder="请输入{{item.title}}" rows="2"></textarea>
							<div class="weui_textarea_counter"><span>0</span>/118</div>
						</div>
					</div>
				</div>
				<div ng-if="item.type == 7" class="weui_cells_title" style="padding-left:0">{{item.title}}</div>
				<div ng-if="item.type == 7" class="weui_cells weui_cells_form" ng-init="get_data(pagedata,'extradata',{plugin:'core',action:'member.set',op:'get'})">
					<div class="weui_cell" ng-init="pagedata.getlocation(item)">
						<div class="fui-cell-label" style="width:33%">
							<select ng-model="item.data.province" class="form-control tpl-province">
							<option value="" selected="selected">省份</option>
							<option ng-repeat="(value,data) in pagedata.extradata.province" value="{{value}}" ng-selected="item.data.province==value">{{value}}</option>
							</select>
						</div>
						<div class="fui-cell-label" style="width:33%">
							<select ng-model="item.data.city" class="form-control tpl-city">
							<option value="" selected="selected">城市</option>
							<option ng-repeat="(value,data) in pagedata.extradata.province[item.data.province]" value="{{value}}" ng-selected="item.data.city==value">{{value}}</option>
							</select>
						</div>
						<div class="fui-cell-label" style="width:33%">
							<select ng-model="item.data.district" class="form-control tpl-district">
							<option value="" selected="selected">区县</option>
							<option ng-repeat="(value,data) in pagedata.extradata.province[item.data.province][item.data.city]" value="{{value}}" ng-selected="item.data.district==value">{{value}}</option>
							</select>
						</div>
						<div class="fui-cell-label" style="width:28%">
							<select ng-model="item.data.street" class="form-control tpl-district">
							<option value="" selected="selected">街道</option>
							<option ng-repeat="value in pagedata.extradata.province[item.data.province][item.data.city][item.data.district]" value="{{value}}" ng-selected="item.data.street==value">{{value}}</option>
							</select>
						</div>
					</div>
				</div>
				<div class="weui_cell" ng-if="item.type == 10">
						<div class="weui_cell_bd weui_cell_primary" style="padding:0;padding-bottom:0.3rem">
							<div class="weui_label" style="margin-bottom:0.3rem"><span>{{item.title}}</span></div>
							<div class="weui_uploader">
								<div class="weui_uploader_bd">
									<ul class="weui_uploader_files">
										<li ng-repeat="p in item.data track by $index" class="weui_uploader_file" style="background-image:url('{{tomedia(p)}}')">
											<div class="upbtn" >
												<i class="icon icon-shangyi" style="color:#f60" href="javascript:;" ng-click="item.data.splice($index-1,0,p);item.data.splice($index+1,1)"></i>
												<i class="icon icon-close" style="color:#f60" href="javascript:;" ng-click="item.data.splice($index,1)"></i>
											</div>
										</li>
									</ul>
									<div class="weui_uploader_input_wrp" href="javascript:;" ng-click="images(item,'data')">
									</div>
								</div>
							</div>
						</div>
				</div>
				<div class="weui_cell" ng-if="item.type == 11">
					<div class="weui_cell_bd weui_cell_primary" style="">
								<div class="weui_label" style="margin-bottom:0.3rem"><span>{{item.title}}</span></div>
								<ul class="weui_uploader_files" ng-if="item.data">
									  <li class="weui_uploader_file" style="width: 108px;height: 60px;background: #333;">
										<video ng-src="{{tomedia(item.data)}}" poster="{{tomedia(item.thumb)}}" height="60" width="100%"  x5-playsinline="" playsinline="" webkit-playsinline="" preload="auto"></video>
									  </li>
								</ul>
								<div class="weui_uploader_input_wrp" ng-if="!item.data">
									 <input class="weui_uploader_input" ng-click="pagedata.up_file($index)"  multiple="">
								</div>
							</div>
				</div>
				<div class="weui_cell" ng-if="item.type == 13">
					<div class="weui_cell_hd"><label class="weui_label">{{item.title}}<span ng-if="item.is_must || item.ismust" class="must"></span></label></div>
					<div class="weui_cell_bd weui_cell_primary">
						<input class="weui_input" type="text" ng-model="item.data" placeholder="输入{{item.title}}">
					</div>
					<div class="weui_cell_ft" ng-click="tool.choose_location(item,'data','address')"><i class="icon jinyunicon icon-ditu"></i></div>
				</div>
				<div class="weui_cell" ng-if="item.type == 14">
							<div class="weui_cell_hd"><label class="weui_label">{{item.title}}</label></div>
							<div class="weui_cell_bd weui_cell_primary">
								<input class="weui_input" type="datetime-local" ng-model="item.data" placeholder="请选择{{item.title}}">
							</div>
				</div>
				<div class="weui_cell weui_cell_switch" ng-if="item.type == 20">
						<div class="weui_cell_hd">{{item.title}}</div>
						<div class="weui_cell_bd weui_cell_primary">
							<input class="weui_switch" type="checkbox" ng-value="item.data==1" ng-click="toogle(item,'data',[1,0])" />
						</div>
			    </div>
				<div class="weui_cell" ng-if="item.type == 21">
								<div class="weui_cell_hd"><label class="weui_label">车牌号</label></div>
								<div class="weui_cell_hd pic_city" ng-click="pagedata.showcity_list=true;pagedata.itemkey=$index">
									{{item.data[0] || '粤'}}
								</div>
								<div class="weui_cell_hd pic_num" ng-click="pagedata.shownum_list=true;pagedata.itemkey=$index">
									{{item.data[1] || 'A'}}
								</div>
								<div class="weui_cell_bd weui_cell_primary" style="padding-left:0;margin-left:0;width:5rem">
									<input type="text" style="padding-left:0;" placeholder="填写车牌号" id="plate_number" ng-model="item.data[2]">
								</div>
			   </div>
</div>
<div ng-if="pagedata.showcity_list" class="popup" style="">
				<div class="popup-body">
				 <div class="popup-bottom">
				 <div class='fui-content' style="background:#fff;padding-bottom:0">
					<div class="fui-page-title c" style="margin-top:1rem">请选择</div>
					<div class="fui-icon-group noborder col-5" style="padding:0.6rem">
					  <div class="fui-icon-col-sm city_item bold" style="width:16.6%;margin:0;padding:0;font-size:0.8rem;color:#fff" ng-repeat="v in pagedata.city_list" ng-click="pagedata.set21city(v);pagedata.showcity_list=false">
							<span class="btn">{{v}}</span>
					  </div>
					 </div>
					 <div class="modal-footer">
					    <a href="javascript:;" class="mod-check" style="background:#ddd;color:#333;border-radius:0" ng-click="pagedata.showcity_list=false">关闭</a>
					 </div>
				 </div>
				</div>
			</div>
</div>
<div ng-if="pagedata.shownum_list" class="popup" style="">
				<div class="popup-body">
				 <div class="popup-bottom">
				 <div class='fui-content' style="background:#fff;padding-bottom:0">
					<div class="fui-page-title c" style="margin-top:1rem">请选择</div>
					<div class="fui-icon-group noborder col-5" style="padding:0.6rem">
					  <div class="fui-icon-col-sm city_item bold" style="width:16.6%;margin:0;padding:0;font-size:0.8rem;color:#fff" ng-repeat="v in pagedata.num_list" ng-click="pagedata.set21num(v);pagedata.shownum_list=false">
							<span class="btn">{{v}}</span>
					  </div>
					 </div>
					 <div class="modal-footer">
					    <a href="javascript:;" class="mod-check" style="background:#ddd;color:#333;border-radius:0" ng-click="pagedata.shownum_list=false">关闭</a>
					 </div>
				 </div>
				</div>
			</div>
</div>
<script type="text/javascript">
scope.pagedata.extradata=scope.pagedata.extradata?scope.pagedata.extradata:{}
scope.pagedata.city_list=['京','津','冀','晋','蒙','辽','吉','黑','沪','苏','浙','皖','闽','赣','鲁','豫','鄂','湘','粤','桂','琼','渝','川','贵','云','藏','陕','甘','青','宁','新','港','澳']
scope.pagedata.num_list=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
scope.pagedata.getlocation=function(item){
		window.scope.location(function(re){
			item.data={};
				item.data.province = re.addressComponents.province
				item.data.city = re.addressComponents.city
				item.data.district = re.addressComponents.district
			scope.$evalAsync();
		});
}
scope.pagedata.set21city=function(value){
	var itemkey=scope.pagedata.itemkey;
	scope.pagedata.item.diyform[itemkey].data=scope.pagedata.item.diyform[itemkey].data?scope.pagedata.item.diyform[itemkey].data:{}
	scope.pagedata.item.diyform[itemkey].data[0]=value
}
scope.pagedata.set21num=function(value){
	var itemkey=scope.pagedata.itemkey;
	scope.pagedata.item.diyform[itemkey].data=scope.pagedata.item.diyform[itemkey].data?scope.pagedata.item.diyform[itemkey].data:{}
	scope.pagedata.item.diyform[itemkey].data[1]=value
}
scope.pagedata.diyfrompost=function(){
	var str = /^[1][3,4,5,7,8][0-9]{9}$///手机
    var strname =  /^[\u4e00-\u9fa5]+(·[\u4e00-\u9fa5]+)*$/ //中文
    var stremail = /^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/
    var filedata = scope.pagedata.item.diyform
	for (var i=0;i<filedata.length;i++){
		if((filedata[i].ismust ==1 || filedata[i].ismust ==1) && !filedata[i].data){
			console.log(filedata[i])
			scope.message(filedata[i].title +'-不能为空！','error');
			return false
		}
		if(filedata[i].type ==8 && (filedata[i].ismust ==1 || filedata[i].ismust ==1)){
			if(!(str.test(filedata[i].data))){
			  scope.message("请输入正确的手机号码！",'error')
			}
		}
		if(filedata[i].type ==9 && (filedata[i].ismust ==1 || filedata[i].ismust ==1)){
			if(!(stremail.test(filedata[i].data))){
			  scope.message("请输入正确的邮箱！",'error')
			}
		}
	}
	scope.post_json('jy_quanhuo/item/diyform/',scope.pagedata.item,function(res){
		scope.message(res,'success','jy_quanhuo/order/');
	});
}
</script>
